﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WxSDK
{
    /// <summary>
    /// 微信实体类
    /// </summary>
    public class WeChatModel
    {
        /// <summary>
        /// 微信公众平台接口返回信息实体
        /// </summary>
        public class result {
            public string errcode { get; set; }
            public string errmsg { get; set; }
        }

        /// <summary>
        /// 获取JSAPI签名相关 jsapi_ticket
        /// </summary>
        public class JsApiTicket {
            public string appid { get; set; }
            public string timestamp { get; set; }
            public string nonceStr { get; set; }
            public string signature { get; set; }
        }

        /// <summary>
        /// auth鉴权 获取AccessToken
        /// </summary>
        public class authAccessToken
        {
            public string access_token;
            public string expires_in;
            public string refresh_token;
            public string openid;
            public string scope;
            public string unionid;
        }

        /// <summary>
        /// 关注用户信息
        /// </summary>
        public class userInfo
        {
            public int subscribe { get; set; }
            public string openid { get; set; }
            public string nickname { get; set; }
            public int sex { get; set; }
            public string language { get; set; }
            public string city { get; set; }
            public string province { get; set; }
            public string country { get; set; }
            public string headimgurl { get; set; }
            public string subscribe_time { get; set; }
            public string unionid { get; set; }
            public string remark { get; set; }
            public int groupid { get; set; }
        }

        /// <summary>
        /// 二维码票据
        /// </summary>
        public class qrTicket {
            public string ticket { get; set; }
            public int expire_seconds { get; set; }
            public string url { get; set; }
        }

        /// <summary>
        /// 图文消息
        /// </summary>
        public class TuWen {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string ArticleCount { get; set; }
            public string Articles { get; set; }
        }

        #region 接收到的消息实体
        public class Msg_Txt
        {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Content { get; set; }
            public string MsgId { get; set; }
        }
        public class Msg_Pic
        {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string PicUrl { get; set; }
            public string MediaId { get; set; }
            public string MsgId { get; set; }
        }
        public class Msg_Voice
        {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string MediaId { get; set; }
            public string Format { get; set; }
            public string MsgID { get; set; }
        }
        public class Msg_Video {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string MediaId { get; set; }
            public string ThumbMediaId { get; set; }
            public string MsgId { get; set; }
        }
        public class Msg_ShortVideo {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string MediaId { get; set; }
            public string ThumbMediaId { get; set; }
            public string MsgId { get; set; }
        }
        public class Msg_Location {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Location_X { get; set; }
            public string Location_Y { get; set; }
            public string Scale { get; set; }
            public string Label { get; set; }
            public string MsgId { get; set; }
        }
        public class Msg_Link {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Title { get; set; }
            public string Description { get; set; }
            public string Url { get; set; }
            public string MsgId { get; set; }
        }

        public class Event_Subscribe {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
        }
        public class Event_SubscribePara {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string EventKey { get; set; }
            public string Ticket { get; set; }
        }
        public class Event_UnSubscribe {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
        }
        public class Event_Scan {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string EventKey { get; set; }
            public string Ticket { get; set; }
        }
        public class Event_Location {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string Latitude { get; set; }
            public string Longitude { get; set; }
            public string Precision { get; set; }
        }
        public class Event_Click {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string EventKey { get; set; }
        }
        public class Event_View {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string EventKey { get; set; }
        }
        public class Event_TemplateSendJobFinish {
            public string ToUserName { get; set; }
            public string FromUserName { get; set; }
            public string CreateTime { get; set; }
            public string MsgType { get; set; }
            public string Event { get; set; }
            public string MsgID { get; set; }
            public string Status { get; set; }
        }
        #endregion

        #region 用户模板列表
        /// <summary>
        /// 获取的所有模板
        /// </summary>
        public class MsgTemplateList { 
            /// <summary>
            /// 单个模板内容
            /// </summary>
            public List<MsgTemplate> template_list;
        }
        public class MsgTemplate {
            public string template_id { get; set; }
            public string title { get; set; }
            public string primary_industry { get; set; }
            public string deputy_industry { get; set; }
            public string content { get; set; }
            public string example { get; set; }
        }
        #endregion
        /// <summary>
        /// 微信红包 - 现金红包
        /// </summary>
        public class RedMoneyPacket {
            /// <summary>
            /// 随机字符串，不长于32位
            /// </summary>
            public string nonce_str { get; set; }
            /// <summary>
            /// 签名 传参数的时候不用管这个
            /// </summary>
            public string sign{get;set;}
            /// <summary>
            /// 商户订单号（每个订单号必须唯一）
            /// 组成： mch_id+yyyymmdd+10位一天内不能重复的数字。
            /// 接口根据商户订单号支持重入， 如出现超时可再调用。
            /// </summary>
            public string mch_billno{get;set;}
            /// <summary>
            /// 微信支付分配的商户号
            /// </summary>
            public string mch_id{get;set;}
            /// <summary>
            /// 商户appid
            /// </summary>
            public string wxappid{get;set;}
            /// <summary>
            /// 红包发送者名称
            /// </summary>
            public string send_name{get;set;}
            /// <summary>
            /// 接受收红包的用户
            /// 用户在wxappid下的openid
            /// </summary>
            public string re_openid{get;set;}
            /// <summary>
            /// 付款金额，单位分
            /// </summary>
            public string total_amount{get;set;}
            /// <summary>
            /// 红包发放总人数
            /// total_num=1
            /// </summary>
            public string total_num{get;set;}
            /// <summary>
            /// 红包祝福语
            /// </summary>
            public string wishing{get;set;}
            /// <summary>
            /// 调用接口的机器Ip地址
            /// </summary>
            public string client_ip{get;set;}
            /// <summary>
            /// 活动名称
            /// </summary>
            public string act_name{get;set;}
            /// <summary>
            /// 备注信息
            /// </summary>
            public string remark{get;set;}
        }

        /// <summary>
        /// 微信红包    -  裂变红包
        /// </summary>
        public class RedChangePacket
        {
            /// <summary>
            /// 签名 传参数的时候不用管这个
            /// </summary>
            public string sign { get; set; }
            /// <summary>
            /// 商户订单号（每个订单号必须唯一）
            /// 组成： mch_id+yyyymmdd+10位一天内不能重复的数字。
            /// 接口根据商户订单号支持重入， 如出现超时可再调用。
            /// </summary>
            public string mch_billno { get; set; }
            /// <summary>
            /// 微信支付分配的商户号
            /// </summary>
            public string mch_id { get; set; }
            /// <summary>
            /// APPID
            /// </summary>
            public string wxappid { get; set; }
            /// <summary>
            /// 红包发送者名称
            /// </summary>
            public string send_name { get; set; }
            /// <summary>
            /// 接受收红包的用户
            /// 用户在wxappid下的openid
            /// </summary>
            public string re_openid { get; set; }
            /// <summary>
            /// 红包发放总金额 单位 分
            /// </summary>
            public string total_amount { get; set; }
            /// <summary>
            /// 红包金额设置方式
            /// </summary>
            public string amt_type { get; set; }
            /// <summary>
            /// 红包发放总人数
            /// total_num=1
            /// </summary>
            public string total_num { get; set; }
            /// <summary>
            /// 红包祝福语
            /// </summary>
            public string wishing { get; set; }
            /// <summary>
            /// 活动名称
            /// </summary>
            public string act_name { get; set; }
            /// <summary>
            /// 备注信息
            /// </summary>
            public string remark { get; set; }
            /// <summary>
            /// 随机字符串，不长于32位
            /// </summary>
            public string nonce_str { get; set; }

        }


    }


    /// <summary>
    /// 微信请求URL string.Formart 带参
    /// </summary>
    public class WeChat_Url {
        /// <summary>
        /// 二维码地址 1个参数 ticket
        /// </summary>
        public static string GetQrImgSrc = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={0}";
        /// <summary>
        /// 获取用户信息 2个参数 access_token openid
        /// </summary>
        public static string GetUserInfo = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN";
        /// <summary>
        /// 获取 全局AccessToken 2个参数 appid secret
        /// </summary>
        public static string GetAccessToken = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}";
        /// <summary>
        /// 获取Code的Url  4个参数  appid redirect_uri scope(snsapi_base,snsapi_userinfo) state(STATE)
        /// </summary>
        public static string GetCode = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={3}#wechat_redirect";
        /// <summary>
        /// 获取用户OpenId的Url  3个参数 appid secret code
        /// </summary>
        public static string GetOpenId = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code";
        /// <summary>
        /// 获取二维码Ticket的Url 1个参数 access_token
        /// </summary>
        public static string GetQRCode = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}";
        /// <summary>
        /// 发送现金红包Url 需要Https 的 Post  无需Url参数
        /// </summary>
        public static string SendRedMoneyPacket = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack";
        /// <summary>
        /// 发送裂变红包Url 需要Https 的 Post  无需Url参数
        /// </summary>
        public static string SendRedChangePacket = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendgroupredpack";
        /// <summary>
        /// 创建自定义菜单接口 需要Https 的 Post  1个参数 access_token
        /// </summary>
        public static string CreateMenu = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}";
        /// <summary>
        /// 通过code换取网页授权access_token 仅用于用户获取授权  3个参数 appid secret code 
        /// </summary>
        public static string UserAuthAccessToken = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code";
        /// <summary>
        /// Auth鉴权  获取用户信息  通过AccessToken(用户授权AccessToken) 2个参数 accesstoken openid
        /// </summary>
        public static string UserAuthGetUserInfo = "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang=zh_CN";
        /// <summary>
        /// 发送模板消息 1个参数 accesstoken
        /// </summary>
        public static string SendTemplateMsg = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}";
        /// <summary>
        /// 获取模板列表  1个参数 accesstoken
        /// </summary>
        public static string GetTemplateList = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token={0}";
        /// <summary>
        /// 获取JsApiTicket 1个参数 accestoken
        /// </summary>
        public static string GetJSApiTicket = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi";
    }
   
}


